#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>

int
main(int argc, char **argv)
{
	int seq[1000], n;
	register int i = 0;

	scanf("%d", &n);
	while (i < (n + 1) / 2) {
		scanf("%d", &seq[i]);
		i++;
	}
	while (i < n) {
		scanf("%d", &seq[i]);
		if (seq[i] != seq[n - i - 1]) {
			puts("NO");
			return 0;
		}
		i++;
	}
	puts("YES");

	return 0;
}
